import { assign, pick, isEmpty } from 'lodash-es';
import { observable, action } from 'mobx';

export default class CircleModel {
  // 方便调试，随机摆放位置
  @observable x = 500 * Math.random();
  @observable y = 600 * Math.random();
  @observable r = 30;
  @observable fill = 'green';
  type = 'circle';
  @action.bound
  move(deltaX, deltaY) {
    this.x += deltaX;
    this.y += deltaY;
  }
  constructor(data) {
    assign(this, pick(data, [
      'r',
      'x',
      'y',
      'fill',
    ]));
  }
}
